package com.my.test.user.ctrl.api;

import java.io.FileOutputStream;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/imgApi")
public class ImgCtrl {

	public String img(HttpServletRequest request,HttpServletResponse response)
			throws ServletException, IOException{
		ServletInputStream sis = request.getInputStream();
		FileOutputStream fos = new FileOutputStream("");
        byte[] media = new byte[1024];
        int length = sis.read(media, 0, 1024);
        while(length  != -1){
           fos.write(media, 0, length);
           length = sis.read(media, 0, 1024);       
        }
        fos.close();
        sis.close();
		return "";
	}
}
